global:
  scrape_interval:     30s
  scrape_timeout:      15s
  evaluation_interval: 30s

scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: ['{{ ansible_host }}:9095']
        labels:
          instance: prometheus

  - job_name: mysqld-exporter
    static_configs:
      - targets: ['{{ mysqld_exporter }}:9104']
        labels:
          instance: mysql-exporter
    
  - job_name: redis-exporter
    static_configs:
      - targets: ['{{ redis_exporter }}:9121']
        labels:
          instance: redis-exporter
  
  - job_name: node-exporter
    static_configs:
      - targets: ['{{ node_exporter }}:9100']
        labels:
          instance: node-exporter

  - job_name: pushgateway
    static_configs:
      - targets: ['{{ ansible_host }}:9096']
        labels:
          instance: pushgateway
  
  - job_name: alertmanager
    static_configs:
      - targets: ['{{ ansible_host }}:9093']
        labels:
          instance: alertmanager

  - job_name: grafana
    static_configs:
      - targets: ['{{ ansible_host }}:3000']
        labels:
          instance: grafana
  
  - job_name: kafka-exporter
    static_configs:
      - targets: ['{{ kafka_exporter }}:9308']
        labels:
          instance: kafka-exporter

  - job_name: 'emqx'
    metrics_path: /api/v5/prometheus/stats
    scrape_interval: 30s
    honor_labels: true
    static_configs:
      # EMQX IP address and port
      - targets: ['{{ emqx_exporter }}:18083']
  
alerting:
  alertmanagers:
    - static_configs:
        - targets:
           - {{ ansible_host }}:9093

rule_files:
  - "/etc/prometheus/template/*.yaml"